home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 January / macformat-020.iso / Shareware City / Developers / apps.to.go / DTS.Lib / DTS.Lib.headers / StringUtils.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-15  |  24.4 KB  |  734 lines  |  [TEXT/MPS ]

  1. /*
  2. **    Apple Macintosh Developer Technical Support
  3. **
  4. **    Header file for collection of String Utilities for DTS Sample code
  5. **
  6. **    Copyright © 1988-1992 Apple Computer, Inc.
  7. **    All rights reserved.
  8. */
  9.  
  10.  
  11. #ifndef __STRINGUTILS__
  12. #define __STRINGUTILS__
  13.  
  14. #ifdef applec
  15.  
  16. #ifndef __TYPES__
  17. #include <Types.h>
  18. #endif
  19.  
  20. #endif
  21.  
  22.  
  23. /*    These are duplicates of c-library functions.  The reason for duplicating them
  24. **    is so that the StringUtils code can be small and linked in with other code that
  25. **    stays resident at all times.  It is possible that when you call code to do
  26. **    something as seemingly innocent as getting the length of a string, memory can
  27. **    move.  This is because the code you are calling isn't necessarily in memory.
  28. **    If the code segment that contains the code you are calling isn't in ram, then
  29. **    it has to be loaded.  Loading the code may cause memory compaction, and therefore
  30. **    memory can move.  The pointer to the string is already pushed on the stack prior
  31. **    to the call, so if you passed a pointer into an unlocked handle, after calling
  32. **    the code, that handle may have moved, and therefore the pointer is invalid.
  33. **
  34. **    To prevent the above problem, alternate names were used for these common library
  35. **    functions.  Link this code into the same segment that holds main(), and you will
  36. **    be guaranteed that they will be in memory whenever you call them. */
  37.  
  38. short    clen(char *cptr);
  39.     /*
  40.     **    ¶ Return the length of the c-string.
  41.     **
  42.     **    INPUT:    cptr        Pointer to c-string to get length for.
  43.     **    RESULT:    short        Length of c-string.
  44.     **
  45.     **    Return the length of the c-string. */
  46.  
  47. char    *ccat(char *s1, char *s2);
  48.     /*
  49.     **    ¶ Catenate two c-strings.
  50.     **
  51.     **    INPUT:    s1            Destination string to catenate onto.
  52.     **            s2            String to catenate with.
  53.     **    RESULT:    char *        Pointer to target string.
  54.     **
  55.     **    Catenate two c-strings (s2 onto end of s1). */
  56.  
  57. char    *ccpy(char *s1, char *s2);
  58.     /*
  59.     **    ¶ Copy a c-string.
  60.     **
  61.     **    INPUT:    s1            Destination string for copy.
  62.     **            s2            String to copy.
  63.     **    RESULT:    char *        Pointer to target string.
  64.     **
  65.     **    Copy a c-string (s2 onto s1). */
  66.  
  67. short    pcmp(StringPtr s1, StringPtr s2);
  68.     /*
  69.     **    ¶ Compare two pascal-strings.
  70.     **
  71.     **    INPUT:    s1        String effectively to the "left" of the compare.
  72.     **            s2        String effectively to the "right" of the compare.
  73.     **    RESULT:    short    Signed value.  If < 0, then s1 < s2.
  74.     **                                   If > 0, then s1 > s2.
  75.     **                                   if = 0, then strings are equal.
  76.     **
  77.     **    Compare two pascal-strings. */
  78.  
  79. void    pcat(StringPtr d, StringPtr s);
  80.     /*
  81.     **    ¶ Catenate two pascal-strings.
  82.     **
  83.     **    INPUT:    d        Destination string to catenate onto.
  84.     **            s        String to catenate with.
  85.     **
  86.     **    Catenate two pascal-strings (s onto end of d). */
  87.  
  88. void    pcpy(StringPtr d, StringPtr s);
  89.     /*
  90.     **    ¶ Copy a pascal-string.
  91.     **
  92.     **    INPUT:    d        Destination string for copy.
  93.     **            s        String to copy.
  94.     **
  95.     **    Copy a pascal-string (s onto d). */
  96.  
  97. void    c2p(char *cptr);
  98.     /*
  99.     **    ¶ Convert a c-string to a pascal-string.
  100.     **
  101.     **    INPUT:    cptr    The string to convert.
  102.     **
  103.     **    Convert a c-string to a pascal-string.
  104.     **
  105.     **    __________
  106.     **
  107.     **    Also see:    p2c. */
  108.  
  109. void    p2c(StringPtr cptr);
  110.     /*
  111.     **    ¶ Convert a pascal-string to a c-string.
  112.     **
  113.     **    INPUT:    cptr    The string to convert.
  114.     **
  115.     **    Convert a pascal-string to a c-string.
  116.     **
  117.     **    __________
  118.     **
  119.     **    Also see:    c2p. */
  120.  
  121. /*****************************************************************************/
  122.  
  123. /*    These are useful, relatively small routines for string manipulation.  As with the above calls,
  124. **    link them into the code segment that holds main().
  125. **
  126. **    With the below functions, you will have most of the functionality of sprintf using shorts and
  127. **    longs.  It will take more calls, but only what you call is linked in. */
  128.  
  129.  
  130. /**/
  131.  
  132. void    ccatchr(char *cptr, char c, short count);
  133.     /*
  134.     **    ¶ Catenate a single character multiple times onto the designated string.
  135.     **
  136.     **    INPUT:    cptr        String to catenate character to.
  137.     **            c            Character to catenate.
  138.     **            count        Number of times to catenate char.
  139.     **
  140.     **    Catenate a single character multiple times onto the designated string.
  141.     **
  142.     **    __________
  143.     **
  144.     **    Also see:    ccpychr, pcatchr, pcpychr. */
  145.  
  146. void    ccatpaddec(char *cptr, char padChr, short minApnd, short maxApnd, long v);
  147.     /*
  148.     **    ¶ Convert value into base-10 text and catenate it onto the string, with padding.
  149.     **
  150.     **    INPUT:    cptr        String to catenate to.
  151.     **            padChr        Character to pad with (or 0 for none).
  152.     **            minApnd        Minimum length of string, if there is a non-0 pad char.
  153.     **            maxApnd        Maximum length of string, including padding.
  154.     **            v            Value to convert to text and catenate.
  155.     **
  156.     **    Convert the value into text for the base-10 number and catenate it to the designated string
  157.     **    with padding.  The value is assumed to be signed.  If you wish to have an unsigned decimal
  158.     **    value, call ccatnum with a base of 10.
  159.     **
  160.     **    __________
  161.     **
  162.     **    Also see:    ccatdec. */
  163.  
  164. void    ccatdec(char *cptr, long v);
  165.     /*
  166.     **    ¶ Convert value into base-10 text and catenate it onto the string.
  167.     **
  168.     **    INPUT:    cptr        String to catenate to.
  169.     **            v            Value to convert to text and catenate.
  170.     **
  171.     **    Convert the value into text for the base-10 number and catenate it to
  172.     **    the designated string.  The value is assumed to be signed.  If you wish
  173.     **    to have an unsigned decimal value, call ccatnum with a base of 10.
  174.     **
  175.     **    __________
  176.     **
  177.     **    Also see:    ccatpaddec. */
  178.  
  179. void    ccatpadhex(char *cptr, char padChr, short minApnd, short maxApnd, long v);
  180.     /*
  181.     **    ¶ Convert value into base-16 text and catenate it onto the string, with padding.
  182.     **
  183.     **    INPUT:    cptr        String to catenate to.
  184.     **            padChr        Character to pad with (or 0 for none).
  185.     **            minApnd        Minimum length of string, if there is a non-0 pad char.
  186.     **            maxApnd        Maximum length of string, including padding.
  187.     **            v            Value to convert to text and catenate.
  188.     **
  189.     **    Convert the value into text for the base-16 number and catenate it to the designated
  190.     **    string with padding.  The value is assumed to be unsigned.
  191.     **
  192.     **    __________
  193.     **
  194.     **    Also see:    ccathex. */
  195.  
  196. void    ccathex(char *cptr, long v);
  197.     /*
  198.     **    ¶ Convert value into base-16 text and catenate it onto the string, with no padding.
  199.     **
  200.     **    INPUT:    cptr        String to catenate to.
  201.     **            v            Value to convert to text and catenate.
  202.     **
  203.     **    Convert the value into text for the base-16 number and catenate it to the designated
  204.     **    string with no padding options.  The value is assumed to be unsigned.
  205.     **
  206.     **    __________
  207.     **
  208.     **    Also see:    ccatpadhex. */
  209.  
  210. void    ccatpadnum(char *cptr, char padChr, short minApnd, short maxApnd, long v, short base);
  211.     /*
  212.     **    ¶ Convert value into designated base text and catenate it onto the string, with padding.
  213.     **
  214.     **    INPUT:    cptr        String to catenate to.
  215.     **            padChr        Character to pad with (or 0 for none).
  216.     **            minApnd        Minimum length of string, if there is a non-0 pad char.
  217.     **            maxApnd        Maximum length of string, including padding.
  218.     **            v            Value to convert to text and catenate.
  219.     **            base        Base number is to be represented in.
  220.     **
  221.     **    Convert the value into text for the designated base and catenate it to the designated string
  222.     **    with padding.  If the base is negative, then the output is a signed number.
  223.     **
  224.     **    __________
  225.     **
  226.     **    Also see:    ccatnum. */
  227.  
  228. void    ccatnum(char *cptr, long v, short base);
  229.     /*
  230.     **    ¶ Convert value into designated text and catenate it onto the string, with no padding.
  231.     **
  232.     **    INPUT:    cptr        String to catenate to.
  233.     **            v            Value to convert to text and catenate.
  234.     **            base        Designated base for conversion.  (If negative, conversion is signed.)
  235.     **
  236.     **    Convert the value into text of the designated base and catenate it to the
  237.     **    string with no padding options.  If the base is negative, then the conversion is signed.
  238.     **
  239.     **    __________
  240.     **
  241.     **    Also see:    ccatpadnum. */
  242.  
  243. void    ccpychr(char *cptr, char c, short count);
  244.     /*
  245.     **    ¶ Copy a single character multiple times into the designated string.
  246.     **
  247.     **    INPUT:    cptr    String to replace.
  248.     **            c        Character to place in string.
  249.     **            count    Number of times character should be copied.
  250.     **
  251.     ** Copy a single character multiple times onto the designated string.
  252.     **
  253.     **    __________
  254.     **
  255.     **    Also see:    ccatchr. */
  256.  
  257. void    ccpypaddec(char *cptr, char padChr, short minApnd, short maxApnd, long v);
  258.     /*
  259.     **    ¶ Convert value into base-10 text and copy it into the string, with padding.
  260.     **
  261.     **    INPUT:    cptr        String to copy into.
  262.     **            padChr        Character to pad with (or 0 for none).
  263.     **            minApnd        Minimum length of string, if there is a non-0 pad char.
  264.     **            maxApnd        Maximum length of string, including padding.
  265.     **            v            Value to convert to text and copy.
  266.     **
  267.     **    Convert the value into text for the base-10 number and copy it into the designated string
  268.     **    with padding.  The value is assumed to be signed.  If you wish to have an unsigned decimal
  269.     **    value, call ccpypadnum with a base of 10.
  270.     **
  271.     **    __________
  272.     **
  273.     **    Also see:    ccpydec. */
  274.  
  275. void    ccpydec(char *cptr, long v);
  276.     /*
  277.     **    ¶ Convert value into base-10 text and copy it into the string.
  278.     **
  279.     **    INPUT:    cptr        String to copy into.
  280.     **            v            Value to convert to text and copy.
  281.     **
  282.     **    Convert the value into text for the base-10 number and copy it into
  283.     **    the designated string.  The value is assumed to be signed.  If you wish
  284.     **    to have an unsigned decimal value, call ccatnum with a base of 10.
  285.     **
  286.     **    __________
  287.     **
  288.     **    Also see:    ccpypaddec. */
  289.  
  290. void    ccpypadhex(char *cptr, char padChr, short minApnd, short maxApnd, long v);
  291.     /*
  292.     **    ¶ Convert value into base-16 text and copy it into the string, with padding.
  293.     **
  294.     **    INPUT:    cptr        String to copy into.
  295.     **            padChr        Character to pad with (or 0 for none).
  296.     **            minApnd        Minimum length of string, if there is a non-0 pad char.
  297.     **            maxApnd        Maximum length of string, including padding.
  298.     **            v            Value to convert to text and copy.
  299.     **
  300.     **    Convert the value into text for the base-16 number and copy it into the designated
  301.     **    string with padding.  The value is assumed to be unsigned.
  302.     **
  303.     **    __________
  304.     **
  305.     **    Also see:    ccpyhex. */
  306.  
  307. void    ccpyhex(char *cptr, long v);
  308.     /*
  309.     **    ¶ Convert value into base-16 text and copy it into the string, with no padding.
  310.     **
  311.     **    INPUT:    cptr        String to copy into.
  312.     **            v            Value to convert to text and copy.
  313.     **
  314.     **    Convert the value into text for the base-16 number and copy it into the designated
  315.     **    string with no padding options.  The value is assumed to be unsigned.
  316.     **
  317.     **    __________
  318.     **
  319.     **    Also see:    ccpypadhex. */
  320.  
  321. void    ccpypadnum(char *cptr, char padChr, short minApnd, short maxApnd, long v, short base);
  322.     /*
  323.     **    ¶ Convert value into designated base text and copy it into the string, with padding.
  324.     **
  325.     **    INPUT:    cptr        String to copy into.
  326.     **            padChr        Character to pad with (or 0 for none).
  327.     **            minApnd        Minimum length of string, if there is a non-0 pad char.
  328.     **            maxApnd        Maximum length of string, including padding.
  329.     **            v            Value to convert to text and copy.
  330.     **            base        Base number is to be represented in.
  331.     **
  332.     **    Convert the value into text for the designated base and copy it into the designated string
  333.     **    with padding.  If the base is negative, then the output is a signed number.
  334.     **
  335.     **    __________
  336.     **
  337.     **    Also see:    ccpynum. */
  338.  
  339. void    ccpynum(char *cptr, long v, short base);
  340.     /*
  341.     **    ¶ Convert value into designated text and copy it into the string, with no padding.
  342.     **
  343.     **    INPUT:    cptr        String to copy into.
  344.     **            v            Value to convert to text and copy.
  345.     **            base        Designated base for conversion.  (If negative, conversion is signed.)
  346.     **
  347.     **    Convert the value into text of the designated base and copy it into the
  348.     **    string with no padding options.  If the base is negative, then the conversion is signed.
  349.     **
  350.     **    __________
  351.     **
  352.     **    Also see:    ccpypadnum. */
  353.  
  354. long    c2dec(char *cptr, short *charsUsed);
  355.     /*
  356.     **    ¶ Convert the c-string to a decimal number.
  357.     **
  358.     **    INPUT:    cptr        String to convert to a decimal number.
  359.     **            charsUsed    Pointer to short to hold # of chars scanned in the conversion.
  360.     **                        (Pass in nil if you don’t care.)
  361.     **    RESULT:    long        Decimal value.
  362.     **
  363.     **    Convert the c-string to a decimal number.
  364.     **
  365.     **    __________
  366.     **
  367.     **    Also see:    c2hex, c2num. */
  368.  
  369. long    c2hex(char *cptr, short *charsUsed);
  370.     /*
  371.     **    ¶ Convert the c-string to a hex number.
  372.     **
  373.     **    INPUT:    cptr        String to convert to a hex number.
  374.     **            charsUsed    Pointer to short to hold # of chars scanned in the conversion.
  375.     **                        (Pass in nil if you don’t care.)
  376.     **    RESULT:    long        Hex value.
  377.     **
  378.     **    Convert the c-string to a hex number.
  379.     **
  380.     **    __________
  381.     **
  382.     **    Also see:    c2dec, c2num. */
  383.  
  384. long    c2num(char *cptr, short base, short *charsUsed);
  385.     /*
  386.     **    ¶ Convert the c-string to a number of the designated base.
  387.     **
  388.     **    INPUT:    cptr        String to convert to a number of the designated base.
  389.     **            base        Number for the conversion.  (If base is negative, conversion is signed.)
  390.     **            charsUsed    Pointer to short to hold # of chars scanned in the conversion.
  391.     **                        (Pass in nil if you don’t care.)
  392.     **    RESULT:    long        Numeric value.
  393.     **
  394.     **    Convert the c-string to a number of the designated base.  If there are characters
  395.     **    found that determine the base, they will be used instead of the indicated base.
  396.     **
  397.     **    __________
  398.     **
  399.     **    Also see:    c2dec, c2hex. */
  400.  
  401. short    GetLastBase(Boolean handleChars);
  402.     /*
  403.     **    ¶ Returns what base was used when text is converted to a num and sets mode.
  404.     **
  405.     **    INPUT:    handleChars        True if you want c2num or p2num (directly or indirectly)
  406.     **                            to handle character constants.
  407.     **
  408.     **    Sometimes the string being analyzed indicates what base the conversion should be
  409.     **    (i.e., starting with a $).  Also, a common string data type is the 1 to 4 char string,
  410.     **    surrounded by single ticks.  If you want to find out what the base was for the
  411.     **    string, just call GetLastBase.  You also pass in a handleChars value of true or
  412.     **    false.  (The default is false.)  If you pass in true, then c2num, called directly or
  413.     **    indirectly, will convert these strings to numbers. */
  414.  
  415. /**/
  416.  
  417. void    pcatchr(StringPtr pptr, char c, short count);
  418.     /*
  419.     **    ¶ Catenate a single character multiple times onto the designated string.
  420.     **
  421.     **    INPUT:    pptr        String to catenate character to.
  422.     **            c            Character to catenate.
  423.     **            count        Number of times to catenate char.
  424.     **
  425.     **    Catenate a single character multiple times onto the designated string.
  426.     **
  427.     **    __________
  428.     **
  429.     **    Also see:    pcpychr. */
  430.  
  431. void    pcatpaddec(StringPtr pptr, char padChr, short minApnd, short maxApnd, long v);
  432.     /*
  433.     **    ¶ Convert value into base-10 text and catenate it onto the string, with padding.
  434.     **
  435.     **    INPUT:    pptr        String to catenate to.
  436.     **            padChr        Character to pad with (or 0 for none).
  437.     **            minApnd        Minimum length of string, if there is a non-0 pad char.
  438.     **            maxApnd        Maximum length of string, including padding.
  439.     **            v            Value to convert to text and catenate.
  440.     **
  441.     **    Convert the value into text for the base-10 number and catenate it to the designated string
  442.     **    with padding.  The value is assumed to be signed.  If you wish to have an unsigned decimal
  443.     **    value, call pcatnum with a base of 10.
  444.     **
  445.     **    __________
  446.     **
  447.     **    Also see:    pcatdec. */
  448.  
  449. void    pcatdec(StringPtr pptr, long v);
  450.     /*
  451.     **    ¶ Convert value into base-10 text and catenate it onto the string.
  452.     **
  453.     **    INPUT:    pptr        String to catenate to.
  454.     **            v            Value to convert to text and catenate.
  455.     **
  456.     **    Convert the value into text for the base-10 number and catenate it to
  457.     **    the designated string.  The value is assumed to be signed.  If you wish
  458.     **    to have an unsigned decimal value, call pcatnum with a base of 10.
  459.     **
  460.     **    __________
  461.     **
  462.     **    Also see:    pcatpaddec. */
  463.  
  464. void    pcatpadhex(StringPtr pptr, char padChr, short minApnd, short maxApnd, long v);
  465.     /*
  466.     **    ¶ Convert value into base-16 text and catenate it onto the string, with padding.
  467.     **
  468.     **    INPUT:    pptr        String to catenate to.
  469.     **            padChr        Character to pad with (or 0 for none).
  470.     **            minApnd        Minimum length of string, if there is a non-0 pad char.
  471.     **            maxApnd        Maximum length of string, including padding.
  472.     **            v            Value to convert to text and catenate.
  473.     **
  474.     **    Convert the value into text for the base-16 number and catenate it to the designated
  475.     **    string with padding.  The value is assumed to be unsigned.
  476.     **
  477.     **    __________
  478.     **
  479.     **    Also see:    pcathex. */
  480.  
  481. void    pcathex(StringPtr pptr, long v);
  482.     /*
  483.     **    ¶ Convert value into base-16 text and catenate it onto the string, with no padding.
  484.     **
  485.     **    INPUT:    pptr        String to catenate to.
  486.     **            v            Value to convert to text and catenate.
  487.     **
  488.     **    Convert the value into text for the base-16 number and catenate it to the designated
  489.     **    string with no padding options.  The value is assumed to be unsigned.
  490.     **
  491.     **    __________
  492.     **
  493.     **    Also see:    pcatpadhex. */
  494.  
  495. long    pcatnum(StringPtr pptr, long v, short base);
  496.     /*
  497.     **    ¶ Convert value into designated text and catenate it onto the string, with no padding.
  498.     **
  499.     **    INPUT:    pptr        String to catenate to.
  500.     **            v            Value to convert to text and catenate.
  501.     **            base        Designated base for conversion.  (If negative, conversion is signed.)
  502.     **
  503.     **    Convert the value into text of the designated base and catenate it to the
  504.     **    string with no padding options.  If the base is negative, then the conversion is signed.
  505.     **
  506.     **    __________
  507.     **
  508.     **    Also see:    pcatpadnum. */
  509.  
  510. void    pcatpadnum(StringPtr pptr, char padChr, short minApnd, short maxApnd, long v, short base);
  511.     /*
  512.     **    ¶ Convert value into designated base text and catenate it onto the string, with padding.
  513.     **
  514.     **    INPUT:    pptr        String to catenate to.
  515.     **            padChr        Character to pad with (or 0 for none).
  516.     **            minApnd        Minimum length of string, if there is a non-0 pad char.
  517.     **            maxApnd        Maximum length of string, including padding.
  518.     **            v            Value to convert to text and catenate.
  519.     **            base        Base number is to be represented in.
  520.     **
  521.     **    Convert the value into text for the designated base and catenate it to the designated string
  522.     **    with padding.  If the base is negative, then the output is a signed number.
  523.     **
  524.     **    __________
  525.     **
  526.     **    Also see:    pcatnum. */
  527.  
  528. void    pcpychr(StringPtr pptr, char c, short count);
  529.     /*
  530.     **    ¶ Copy a single character multiple times into the designated string.
  531.     **
  532.     **    INPUT:    pptr    String to replace.
  533.     **            c        Character to place in string.
  534.     **            count    Number of times character should be copied.
  535.     **
  536.     ** Copy a single character multiple times onto the designated string.
  537.     **
  538.     **    __________
  539.     **
  540.     **    Also see:    pcatchr. */
  541.  
  542. void    pcpypaddec(StringPtr pptr, char padChr, short minApnd, short maxApnd, long v);
  543.     /*
  544.     **    ¶ Convert value into base-10 text and copy it into the string, with padding.
  545.     **
  546.     **    INPUT:    pptr        String to copy into.
  547.     **            padChr        Character to pad with (or 0 for none).
  548.     **            minApnd        Minimum length of string, if there is a non-0 pad char.
  549.     **            maxApnd        Maximum length of string, including padding.
  550.     **            v            Value to convert to text and copy.
  551.     **
  552.     **    Convert the value into text for the base-10 number and copy it into the designated string
  553.     **    with padding.  The value is assumed to be signed.  If you wish to have an unsigned decimal
  554.     **    value, call pcpypadnum with a base of 10.
  555.     **
  556.     **    __________
  557.     **
  558.     **    Also see:    pcpydec. */
  559.  
  560. void    pcpydec(StringPtr pptr, long v);
  561.     /*
  562.     **    ¶ Convert value into base-10 text and copy it into the string.
  563.     **
  564.     **    INPUT:    pptr        String to copy into.
  565.     **            v            Value to convert to text and copy.
  566.     **
  567.     **    Convert the value into text for the base-10 number and copy it into
  568.     **    the designated string.  The value is assumed to be signed.  If you wish
  569.     **    to have an unsigned decimal value, call ccatnum with a base of 10.
  570.     **
  571.     **    __________
  572.     **
  573.     **    Also see:    pcpypaddec. */
  574.  
  575. void    pcpypadnum(StringPtr pptr, char padChr, short minApnd, short maxApnd, long v, short base);
  576.     /*
  577.     **    ¶ Convert value into designated base text and copy it into the string, with padding.
  578.     **
  579.     **    INPUT:    pptr        String to copy into.
  580.     **            padChr        Character to pad with (or 0 for none).
  581.     **            minApnd        Minimum length of string, if there is a non-0 pad char.
  582.     **            maxApnd        Maximum length of string, including padding.
  583.     **            v            Value to convert to text and copy.
  584.     **            base        Base number is to be represented in.
  585.     **
  586.     **    Convert the value into text for the designated base and copy it into the designated string
  587.     **    with padding.  If the base is negative, then the output is a signed number.
  588.     **
  589.     **    __________
  590.     **
  591.     **    Also see:    pcpynum. */
  592.  
  593. void    pcpynum(StringPtr pptr, long v, short base);
  594.     /*
  595.     **    ¶ Convert value into designated text and copy it into the string, with no padding.
  596.     **
  597.     **    INPUT:    pptr        String to copy into.
  598.     **            v            Value to convert to text and copy.
  599.     **            base        Designated base for conversion.  (If negative, conversion is signed.)
  600.     **
  601.     **    Convert the value into text of the designated base and copy it into the
  602.     **    string with no padding options.  If the base is negative, then the conversion is signed.
  603.     **
  604.     **    __________
  605.     **
  606.     **    Also see:    pcpypadnum. */
  607.  
  608. void    pcpypadhex(StringPtr pptr, char padChr, short minApnd, short maxApnd, long v);
  609.     /*
  610.     **    ¶ Convert value into base-16 text and copy it into the string, with padding.
  611.     **
  612.     **    INPUT:    pptr        String to copy into.
  613.     **            padChr        Character to pad with (or 0 for none).
  614.     **            minApnd        Minimum length of string, if there is a non-0 pad char.
  615.     **            maxApnd        Maximum length of string, including padding.
  616.     **            v            Value to convert to text and copy.
  617.     **
  618.     **    Convert the value into text for the base-16 number and copy it into the designated
  619.     **    string with padding.  The value is assumed to be unsigned.
  620.     **
  621.     **    __________
  622.     **
  623.     **    Also see:    pcpyhex. */
  624.  
  625. void    pcpyhex(StringPtr pptr, long v);
  626.     /*
  627.     **    ¶ Convert value into base-16 text and copy it into the string, with no padding.
  628.     **
  629.     **    INPUT:    pptr        String to copy into.
  630.     **            v            Value to convert to text and copy.
  631.     **
  632.     **    Convert the value into text for the base-16 number and copy it into the designated
  633.     **    string with no padding options.  The value is assumed to be unsigned.
  634.     **
  635.     **    __________
  636.     **
  637.     **    Also see:    pcpypadhex. */
  638.  
  639. long    p2dec(StringPtr pptr, short *charsUsed);
  640.     /*
  641.     **    ¶ Convert the pascal-string to a decimal number.
  642.     **
  643.     **    INPUT:    pptr        String to convert to a decimal number.
  644.     **            charsUsed    Pointer to short to hold # of chars scanned in the conversion.
  645.     **                        (Pass in nil if you don’t care.)
  646.     **    RESULT:    long        Decimal value.
  647.     **
  648.     **    Convert the pascal-string to a decimal number.
  649.     **
  650.     **    __________
  651.     **
  652.     **    Also see:    p2hex, p2num. */
  653.  
  654. long    p2hex(StringPtr pptr, short *charsUsed);
  655.     /*
  656.     **    ¶ Convert the pascal-string to a hex number.
  657.     **
  658.     **    INPUT:    pptr        String to convert to a hex number.
  659.     **            charsUsed    Pointer to short to hold # of chars scanned in the conversion.
  660.     **                        (Pass in nil if you don’t care.)
  661.     **    RESULT:    long        Hex value.
  662.     **
  663.     **    Convert the pascal-string to a hex number.
  664.     **
  665.     **    __________
  666.     **
  667.     **    Also see:    p2dec, p2num. */
  668.  
  669. long    p2num(StringPtr pptr, short base, short *charsUsed);
  670.     /*
  671.     **    ¶ Convert the pascal-string to a number of the designated base.
  672.     **
  673.     **    INPUT:    pptr        String to convert to a number of the designated base.
  674.     **            base        Number for the conversion.  (If base is negative, conversion is signed.)
  675.     **            charsUsed    Pointer to short to hold # of chars scanned in the conversion.
  676.     **                        (Pass in nil if you don’t care.)
  677.     **    RESULT:    long        Numeric value.
  678.     **
  679.     **    Convert the pascal-string to a number of the designated base.  If there are characters
  680.     **    found that determine the base, they will be used instead of the indicated base.
  681.     **
  682.     **    __________
  683.     **
  684.     **    Also see:    p2dec, p2hex. */
  685.  
  686. /**/
  687.  
  688. short    GetHexByte(char *cptr);
  689.     /*
  690.     **    ¶ Internal function for returning a hex value from 2 characters.
  691.     **
  692.     **
  693.     **    INPUT:    cptr    Pointer to characters to analyze.
  694.     **    RESULT:    short    Hex value obtained from characters.
  695.     **
  696.     **    This does not analyze just true hex values.  The first character has special meaning for
  697.     **    AppsToGo functions.  (This is really meant to be an internal function.)  If the first
  698.     **    character is a “=”, then the next character’s ascii value is returned as the hex value
  699.     **    for the two characters.  If the first character is a “≈”, then the second character
  700.     **    is upper-cased, and then the ascii value of that is returned. */
  701.  
  702. Boolean    EqualHandle(void *h1, void *h2);
  703.     /*
  704.     **    ¶ Checks to see if two handles are identical.
  705.     **
  706.     **    INPUT:    h1            First handle for compare.
  707.     **            h2            Second handle for compare.
  708.     **    RESULT:    Boolean        Returns true if handles are equal.
  709.     **
  710.     ** This function checks to see if two handles are identical. */
  711.  
  712. Boolean    EqualData(void *v1, void *v2, long size);
  713.     /*
  714.     **    ¶ Checks to see if two blocks of data are identical.
  715.     **
  716.     **    INPUT:    v1            Pointer to first data block.
  717.     **            v2            Pointer to second data block.
  718.     **            size        Length of data blocks.
  719.     **    RESULT:    Boolean        Returns true if blocks are equal.
  720.     **
  721.     ** This function checks to see if two blocks of data are identical. */
  722.  
  723. void    SetMem(void *vptr, unsigned char c, unsigned long len);
  724.     /*
  725.     **    ¶ Sets a block of memory to a specified value.
  726.     **
  727.     **    INPUT:    vptr    Pointer to block of memory to set.
  728.     **            c        Byte value to store into memory.
  729.     **            len        Length of block to set to specified value.
  730.     **
  731.     **    Sets a block of memory to a specified value. */
  732.  
  733. #endif
  734.